$(document).ready(function(){
	$('#submit').click(function(){
		$('form').submit();
	});
	
	$('#info_serie').click(function(){
		id_tvdb =  $('input[name="id_tvdb"]:checked').val();
		if(id_tvdb != undefined){
			ajax_get_info_serie(id_tvdb);
		}
		else{
			alert('Seleccione una Serie de la Lista');
		}
		
	});
});

function ajax_get_info_serie(id_tvdb){
	$.ajax({
		type: "POST",
		url: base_url+lang_url+'panel/series/get_info_serie',
		data: 'tvdb_id='+id_tvdb,
		dataType: 'json',
		success: function(rsp){
			if(rsp.hasOwnProperty('error')==false){				
				window.parent.$('#poster').val(rsp.poster);
				window.parent.$("p.close a").click();
			}
			else{
				alert(rsp.error);
			}
			
		},
		error: function(e){
			alert('Error:' + e);
		}
	});
}